A differentiated services model is a most widely-applied IP QoS (IP Quality of Service, IP quality of service) model at present. In a process in which a network node that uses a differentiated services model sends data, it needs to use tokens to regulate a data sending rate. Furthermore, a token bucket is disposed in the network node and token are stored in the token bucket. The network node needs to consume a certain number of tokens each time sending a certain amount of data. A capacity of the token bucket is preset. Therefore, after the tokens are consumed, tokens need to be periodically added to the token bucket. For example, a storage capacity occupied by tokens added in each period is:PIR*T=Token
A PIR (Peak Information Rate, peak information rate) is a data transmission rate of the network node; T is an adding period of the token; Token is a storage capacity occupied by tokens added each time. In addition, in a process of maintaining tokens, the network node needs to record a storage capacity occupied by tokens added to the token bucket in one period, so as to enable the network node to determine whether all tokens currently stored in the token bucket can support data sending.
To achieve better QoS and control a data sending rate, a short period is generally selected as far as possible to add tokens, for example, a minimum period that can be supported by hardware performance is selected. However, selecting a short period easily causes a decimal part in a Token value, and when the decimal part of the Token value is stored, more storage resources need to be occupied. To avoid existence of a decimal part, a longer period is selected to add a token in the prior art, which enables a Token value in one period to be an integer when a PIR is minimal.
However, a longer period is selected in the prior art, when a PIR is extremely large, a Token value of a token added in one period is too large, which easily causes a burst excess of data that needs to be transmitted, so that a traffic peak occurs and QoS is reduced.